package com.job.client.city.controller;

import com.job.client.city.pojo.CityDefault;
import com.job.client.city.pojo.CityOrder;
import com.job.client.city.pojo.ProvinceDefault;
import com.job.client.city.service.CityService;
import com.job.client.common.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/client/city")
@Api(tags = "客户端城市接口服务")
public class CityController {
    @Autowired
    private CityService cityService;

    @PostMapping("/setDefault")
    @ApiOperation("设置默认的省份-城市二级联动数据")
    public ResponseResult setDefault(@RequestBody List<ProvinceDefault> provinceDefaultList){
        return cityService.setDefault(provinceDefaultList);
    }

    @PostMapping("/setOrder")
    @ApiOperation("设置按照字母排序的城市数据")
    public ResponseResult setOrder(@RequestBody List<CityOrder> cityOrderList){
        return cityService.setOrder(cityOrderList);
    }
    @PostMapping("/setHot")
    @ApiOperation("设置中国热门城市")
    public ResponseResult setHot(@RequestBody List<CityDefault> cityDefaults){
        return cityService.setHot(cityDefaults);
    }

    @GetMapping("/default/all")
    @ApiOperation("获得默认的全部数据")
    public ResponseResult getDefaultAll(){
        return cityService.getDefaultAll();
    }

    @GetMapping("/order/all")
    @ApiOperation("获得字母排序的全部数据")
    public ResponseResult getOrderAll(){
        return cityService.getOrderAll();
    }

    @GetMapping("/hot/all")
    @ApiOperation("获得热门城市的全部数据")
    public ResponseResult getHotAll(){
        return cityService.getHotAll();
    }
}
